package com.whfc.iot.mach.codec;

import com.whfc.iot.mach.entity.MachMsg0x83;
import com.whfc.iot.util.MsgDataCodecUtil;
import io.netty.buffer.ByteBuf;

import java.util.Date;

/**
 * @Description:
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019/9/9 9:35
 */
public class MachMsgDataCodec0x83 implements MachMsgDataCodec<MachMsg0x83> {

    @Override
    public void decode(ByteBuf buf, MachMsg0x83 msg) {
        Date time = MsgDataCodecUtil.readDateTimeWithWeek(buf);
        msg.setTime(time);
    }

    @Override
    public void encode(ByteBuf buf, MachMsg0x83 msg) {
        MsgDataCodecUtil.writeDateTimeWithWeek(buf, msg.getTime());
    }
}
